Populate and Display Contents of an ArrayList

The following function populates an arrayList with some string elements and then retrives them

C# .NET

public static String DoTest()
{
         ArrayList myAL = new ArrayList();
         myAL.Add("Hello ");
         myAL.Add("World");
         myAL.Add("!");
         return PrintValues( ref myAL);
}

public static String PrintValues(ref ArrayList aList)
{
         Int32 nCount = aList.Count;
         String strItem;
         String strAll = "Total items = " + nCount.ToString() + "\r\n";
         for(Int32 nIndex = 0; nIndex < nCount; nIndex++)
         {
                  strItem = (String)aList[nIndex];
                  strAll += strItem ;
         }
         return strAll;
}

 

Blaze++ .NET

static String DoTest()
{
         ArrayList myAL;
         myAL.Add("Hello ");
         myAL.Add("World");
         myAL.Add("!");

         return PrintValues(myAL);
}

static String PrintValues(ArrayList& aList)
{
         Int32 nCount = aList.Count;
         String strAll = "Total items = "+ nCount.ToString() + "\r\n";
         foreach(String, strItem, aList)
         {
                  strAll += strItem;
         }
         return strAll;
}